<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="../../include.inc.jsp"%>
<div class="row">
	<div class="col-lg-12">
		<div class="widget-box transparent" id="divSearch1">
			<div class="widget-body">
				<div class="widget-main">
					<form  name="frmSearch" id="frmSearch1" target="_self"  class="form-inline searchCondition">
	                    <!-- 数据权限 begion-->
	                    <c:if test="${organizationId != 1}"><input type="hidden" name="search_EQ_organization.id" value="${organizationId }"/></c:if>
	                    <!-- 数据权限 end-->
						<label>
							医院名称:&nbsp;<input name="search_LIKE_name" class="form-control" placeholder="请输入医院名称" type="text">
						</label>
						<button id="btnSearch1" type="button" class="btn btn-primary btn-sm form-control">
							<i class="ace-icon fa fa-search icon-on-right bigger-110"></i>
						</button>
					</form>
				</div>
			</div>
		</div>
		<div id="tbWidget1" class="widget-box transparent ui-sortable-handle">
			<div class="widget-body">
				<div class="widget-main no-padding">
					<table id="table-data1" data-single-select=“true”
						data-classes="table table-striped table-hover" 
						   data-pagination="true"
					       data-id-field="id"
					       data-unique-id="id"
					       data-sort-name="createTime"
					       data-sort-order="asc">
					</table>
				</div>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
var scripts = [];
$('.page-content-area').ace_ajax('loadScripts', scripts, function() {
	var ajaxListUrl = contextPath + '/manage/ordering/hospital/list';
	
    //输出字典js变量
    <x:dictData dictCode="Hospital_level" var="hospitalLevels">
    <x:jsonArray varName="levels" keyName="code" valName="name" items="${hospitalLevels}" ></x:jsonArray>
    </x:dictData>
	
	var columns = [ {
		field : 'state',
		checkbox : true,
		title : "选择"
	}, {
		field : 'name',
		sortable : false,
		title : "医院名称"
	}, {
		field : 'level',
		sortable : false,
		title : "医院级别",
		formatter: function(value, row, index){
		    var show = value;
		    $.each(levels, function() {
		        if (this.code == value) {
		            show = this.name;
		        }
		    });
		    return show;
		}
	}, {
// 		field : 'introduction',
// 		sortable : false,
// 		title : "医院简介"
// 	}, {
        field : 'province.name',
        sortable : false,
        title : "省"
    }, {
        field : 'city.name',
        sortable : false,
        title : "市"
    }, {
        field : 'district.name',
        sortable : false,
        title : "区"
    }
	];

	jQuery(function($) {
        initTable('table-data1', columns, ajaxListUrl, 'frmSearch1');
		// 搜索域控制
		$('#frmSearch1').find('#btnSearch1').on('click', function() {
			$('#table-data1').bootstrapTable('selectPage', 1);
		});

		$('#tbWidget1').on('reload.ace.widget', function(ev) {
			$('#table-data1').bootstrapTable('refresh', { silent : true });
		});
	});
});
</script>